<?php
declare(strict_types=1);
namespace App\Dao;

use App\Model\RequestLog;

class RequestlogDao
{
    /**
     * 日志记录显示
     * @Author abell
     * @DateTime 2020-05-28
     * @param array $request
     * @return array
     */
    public function logsList($where,$order,$pageSize,$pageNum,$key=null,$start_time=0,$end_time=0){
        $query = RequestLog::query()->where($where)->orderByRaw($order);
        if($key){
            $data = $query->whereBetween($key,[$start_time,$end_time])
                ->paginate(intval($pageSize),['*'],'page',$pageNum)
                ->toArray();
        }else{
            $data = $query->paginate(intval($pageSize),['*'],'page',$pageNum)->toArray();
        }
        return $data;
    }
}
